package com.huan.iteye.configuration;

import io.swagger.annotations.Api;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * swagger2 配置
 *
 * @author huan.fu
 * @date 2018/9/11 - 10:35
 */
@Configuration
public class Swagger2Configuration {

	@Bean
	public Docket docket() {
		return new Docket(DocumentationType.SWAGGER_2)
				.apiInfo(apiInfo())
				.select()
				.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
				.paths(PathSelectors.any())
				.build();
	}

	private ApiInfo apiInfo() {
		return new ApiInfoBuilder()
				.title("quartz 动态配置")
				.description("实现单机的quartz定时任务动态配置")
				.termsOfServiceUrl("http://huan1993.iteye.com/")
				.contact(new Contact("huan.fu", "http://huan1993.iteye.com/", "1451578387@qq.com"))
				.version("0.0.1-SNAPSHOT")
				.build();
	}

}
